unit waitAnim;


interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,  StdCtrls, Buttons, ExtCtrls, jpeg,registry, {CryptoAPI,} shellApi,
  GIFImg;

 procedure setshadow(Frm:TForm; sh:boolean);
implementation

  var backimg:TBitmap;
    im:TImage;  pn:Tpanel;


procedure Darkness( Bitmap:TBitmap; Amount: integer);
var
Wsk:^Byte;
H,V: Integer;
begin
  Bitmap.pixelformat:=pf24bit;
  for V:=0 to Bitmap.Height-1 do begin
    WSK:=Bitmap.ScanLine[V];
    for H:=0 to Bitmap.Width*3-1 do
    begin
    Wsk^:=(Wsk^-(Wsk^*Amount)div 255);
    inc(Wsk);
  end;
 end;
end;

procedure setshadow(Frm:TForm; sh:boolean);
var i,j:integer;       w,h : integer;
   DC : HDC;

   r : TRect;
begin
if(im=nil) then begin
pn:=TPanel.Create(Frm);
im:=TImage.Create(pn);
end;

if(sh) then begin
im.Hide;
pn.Hide;
end else begin
if im <> nil  then im.Hide;
if im <> nil  then pn.Hide;
application.ProcessMessages;
backimg:=TBitmap.Create;
dc := GetDC(Frm.Handle) ;
GetClientRect(Frm.Handle,r) ;
w := r.Right - r.Left;
h := r.Bottom - r.Top;
backimg.Width := w;
backimg.Height := h;
BitBlt(backimg.Canvas.Handle,0,0,w,h,DC,0,0,SRCCOPY) ;
ReleaseDC(Frm.Handle, DC) ;

Darkness(backimg,160);

pn.Top:=0; pn.Left:=0;
pn.Width:=Frm.Width;
pn.Height:=Frm.Height;
pn.Parent:=Frm;
pn.Visible:=true;

im.Parent:=pn;
im.Top:=0; im.Left:=0;
im.AutoSize:=true; im.Picture.Assign(backimg);
im.Show;
backimg.Free;
end;
end;
end.
